﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Collections;
using System.Data.SqlClient;

namespace DataAccess.Factory
{
    public class BaseFactory
    {
        protected Type classType;


        protected ArrayList DataTableToObjectList(SqlParameter [] parameter, string sp)
        {
            DatabaseDao tmpDao = new DatabaseDao();
            DataTable dt = tmpDao.ExecuteReturnQuery(parameter, sp);

            return DataTableConverter.GetObjects(dt, this.classType);
        }


        protected DataTable DataTableList(SqlParameter[] parameter, string sp)
        {
            DatabaseDao tmpDao = new DatabaseDao();
            return tmpDao.ExecuteReturnQuery(parameter, sp);
        }

        protected int executeNoQuery(SqlParameter[] parameter, string sp)
        {
            DatabaseDao tmpDao = new DatabaseDao();
            return tmpDao.ExecuteNonQuery(parameter, sp);
        }

        protected int executeScalar(SqlParameter[] parameter, string sp)
        {
            DatabaseDao tmpDao = new DatabaseDao();
            return tmpDao.ExecuteScalar(parameter, sp);
        }


        protected int Create(string xmlParams, string sp)
        {
            return 0;
        }
    }
}
